package me.shiqiang.im.domain;

import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.io.Serializable;

/**
 * @author cuishiqiang
 * @date 2017/12/8 下午2:41
 */
@RedisHash("users")
public class User implements Serializable {
    @Id
    private Long userId;

    @Indexed
    private String pwd;

    @Indexed
    private String phone;
    private String name;
    private String signature; // 签名
    private int gender;//性别
    private String area; //区域
    private String avatar;//头像

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }


    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"userId\":")
                .append(userId);
        sb.append(",\"pwd\":\"")
                .append(pwd).append('\"');
        sb.append(",\"phone\":\"")
                .append(phone).append('\"');
        sb.append(",\"name\":\"")
                .append(name).append('\"');
        sb.append(",\"signature\":\"")
                .append(signature).append('\"');
        sb.append(",\"gender\":")
                .append(gender);
        sb.append(",\"area\":\"")
                .append(area).append('\"');
        sb.append(",\"avatar\":\"")
                .append(avatar).append('\"');
        sb.append('}');
        return sb.toString();
    }
}
